package ua.nure.nguyen.blinov.chapter4.a;

public class Word {
	private CharSequence word;
	
	private Word(String word) {
		this.word = word;
	}
	
	public static Word parseWord(String str) {
		if (str == null || str.isEmpty()) {
			return null;
		}
		String[] strs = str.split(" ");
		return new Word(strs[0]);
	}
	
	@Override
	public boolean equals(Object other) {
		if (other instanceof Word == false) {
			return false;
		}
		return word.equals(((Word)other).word);
	}

	@Override
	public String toString() {
		return word.toString();
	}
}
